﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Flow_GetStyleTemplate_V2]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Flow_GetStyleTemplate_V2];
GO
CREATE PROCEDURE [dbo].[sproc_Flow_GetStyleTemplate_V2]
    @FlowID int,
    @Template nvarchar(256) out
AS
BEGIN
SET NOCOUNT ON;

DECLARE @StyleID int;

SELECT @StyleID = style_ID FROM dbo.uds_flow WHERE flow_id = @FlowID;
IF ( @@ROWCOUNT > 0 )
BEGIN
    SELECT @Template = ISNULL(Template, '') FROM dbo.uds_flow_style WHERE style_id = @StyleID;
    
    IF @Template = ''
        RETURN 0;
    ELSE
        RETURN 1;
END
ELSE
BEGIN
    SET @Template = '';
    RETURN -1;
END

END
GO